| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkGraphics::RenderContext Class Referenceabstract

A rendering context, attached to a window or an offscreen texture. More...

## Public Member Functions
virtual | ~RenderContext ()
Texture * | getBackBuffer () const
Texture * | getDepthBuffer () const
GlobalTimer * | getTimer () const
Viewport * | getViewport () const
Compositor * | getCompositor () const
Camera * | getRenderCamera () const
Camera * | getCullingCamera () const
Camera * | getLodCamera () const
int | getWidth () const
int | getHeight () const
bool | isWindowFocused () const
nkWinUi::Window * | getAttachedWin () const
bool | getOwnsSurface () const
void | setCompositor (Compositor *value)
void | setRenderCamera (Camera *value)
void | setCullingCamera (Camera *value)
void | setLodCamera (Camera *value)
void | setOwnsSurface (bool value)
virtual void | setGammaCorrected (bool value)=0
virtual void | initialize (const RenderContextDescriptor &descriptor)=0
virtual void | swap ()=0
virtual void | refreshBufferSize (unsigned int width=0, unsigned int height=0)=0
virtual void | refreshViewportSize ()

## Detailed Description

A rendering context, attached to a window or an offscreen texture.

See RenderContextManager::createRenderContext() for instantiation.

## Constructor & Destructor Documentation

## ◆ ~RenderContext()

virtual nkGraphics::RenderContext::~RenderContext | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ getBackBuffer()

Texture* nkGraphics::RenderContext::getBackBuffer | ( |  | ) | const

Returns
  The texture serving as a back buffer.

## ◆ getDepthBuffer()

Texture* nkGraphics::RenderContext::getDepthBuffer | ( |  | ) | const

Returns
  The depth buffer associated to the context.

## ◆ getTimer()

GlobalTimer* nkGraphics::RenderContext::getTimer | ( |  | ) | const

Returns
  The timer associated to this render context.

## ◆ getViewport()

Viewport* nkGraphics::RenderContext::getViewport | ( |  | ) | const

Returns
  The viewport used.

## ◆ getCompositor()

Compositor* nkGraphics::RenderContext::getCompositor | ( |  | ) | const

Returns
  The compositor the context is using. If nullptr, it means the default compositor within the CompositorManager is used.

## ◆ getRenderCamera()

Camera* nkGraphics::RenderContext::getRenderCamera | ( |  | ) | const

Returns
  The currently used camera for general rendering, when using the context.

## ◆ getCullingCamera()

Camera* nkGraphics::RenderContext::getCullingCamera | ( |  | ) | const

Returns
  The currently used camera for frustum culling, when using the context.

## ◆ getLodCamera()

Camera* nkGraphics::RenderContext::getLodCamera | ( |  | ) | const

Returns
  The currently used camera for LOD selection, when using the context.

## ◆ getWidth()

int nkGraphics::RenderContext::getWidth | ( |  | ) | const

Returns
  The width, in pixels, of the context.

## ◆ getHeight()

int nkGraphics::RenderContext::getHeight | ( |  | ) | const

Returns
  The height, in pixels, of the context.

## ◆ isWindowFocused()

bool nkGraphics::RenderContext::isWindowFocused | ( |  | ) | const

Returns
  Whether the context window is focused (true) or not (false).

## ◆ getAttachedWin()

nkWinUi::Window* nkGraphics::RenderContext::getAttachedWin | ( |  | ) | const

Returns
  The attached window in which the context renders.

## ◆ getOwnsSurface()

bool nkGraphics::RenderContext::getOwnsSurface | ( |  | ) | const

Returns
  Whether the context owns the window or texture it renders to (true) or not (false). A context owns a window when it is not fed a window or texture from external code.

## ◆ setCompositor()

void nkGraphics::RenderContext::setCompositor | ( | Compositor * | value | ) |

Sets the compositor the context should be rendered with.

Parameters

  value | The compositor to use. Can be reset with nullptr.

## ◆ setRenderCamera()

void nkGraphics::RenderContext::setRenderCamera | ( | Camera * | value | ) |

Sets the camera to use during rendering. This camera drives what information the shaders will receive, like the transformation matrices for instance. If this camera is not overloaded, then the used camera will be the default camera registered within the CameraManager.

Parameters

  value | The camera to use. Can be reset with nullptr.

## ◆ setCullingCamera()

void nkGraphics::RenderContext::setCullingCamera | ( | Camera * | value | ) |

Sets the camera to use during frustum culling. This camera will be used by the DefaultRenderStrategy if frustum culling is enabled. If this camera is not overloaded, then the used camera will be the overloaded render camera if set, or the default camera registered within the CameraManager else.

Parameters

  value | The camera to use. Can be reset with nullptr.

## ◆ setLodCamera()

void nkGraphics::RenderContext::setLodCamera | ( | Camera * | value | ) |

Sets the camera to use during LOD selection. This camera will be used by the DefaultRenderStrategy if LOD selection is enabled. If this camera is not overloaded, then the used camera will be the overloaded render camera if set, or the default camera registered within the CameraManager else.

Parameters

  value | The camera to use. Can be reset with nullptr.

## ◆ setOwnsSurface()

void nkGraphics::RenderContext::setOwnsSurface | ( | bool | value | ) |

Sets whether the context owns the window or texture it is attached to.

Parameters

  value | Whether the context owns the surface (true) or not (false).

## ◆ setGammaCorrected()

virtual void nkGraphics::RenderContext::setGammaCorrected | ( | bool | value | ) |
| pure virtual

Sets whether the context should be gamma corrected or not.

Parameters

  value | Whether the context should be gamma corrected (true) or not (false).

## ◆ initialize()

virtual void nkGraphics::RenderContext::initialize | ( | const RenderContextDescriptor & | descriptor | ) |
| pure virtual

Initializes and loads all internal memory necessary.

## ◆ swap()

virtual void nkGraphics::RenderContext::swap | ( |  | ) |
| pure virtual

Part of the rendering logic. In theory, should not be called by external code.

## ◆ refreshBufferSize()

virtual void nkGraphics::RenderContext::refreshBufferSize | ( | unsigned int | width = `0`,
|  | unsigned int | height = `0`
| ) |  |
| pure virtual

Callback for when the window size changes. Can also be used to resize manually the surfaces (window, texture) the context owns.

Parameters

  width | The wanted width of the surface, in pixels.
  height | The wanted height of the surface, in pixels.

Remarks
  If coordinates are left at 0, then the context will resize its internal buffers to fit the new sizes of either the window or the texture used. If coordinates have values > 0, then they are used to also resize the surfaces, provided the context owns them (created along with the context).

## ◆ refreshViewportSize()

virtual void nkGraphics::RenderContext::refreshViewportSize | ( |  | ) |
| virtual

Callback for when the window size changes.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/RenderContexts/RenderContext.h